home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / misc_pto / crcset13 / testcrc.c < prev    next >
C/C++ Source or Header  |  1991-07-12  |  953b  |  52 lines

  1. /*
  2. TESTCRC.C
  3.  
  4. Kevin Dean
  5. Fairview Mall P.O. Box 55074
  6. 1800 Sheppard Avenue East
  7. Willowdale, Ontario
  8. CANADA    M2J 5B9
  9. CompuServe ID: 76336,3114
  10.  
  11. March 24, 1991
  12.  
  13.     This program demonstrates the anti-virus CRC algorithm in VALIDCRC.C.
  14. The response to an invalid CRC is entirely up to the programmer.
  15.  
  16.     This code is public domain.
  17. */
  18.  
  19.  
  20. #include <stdio.h>
  21. #include <stdlib.h>
  22.  
  23. #include "viruscrc.h"
  24.  
  25.  
  26. /***/
  27. main()
  28. {
  29. switch (validatecrc("TESTCRC.EXE"))
  30.   {
  31.   case CRC_VALID:
  32.     puts("CRC is valid.");
  33.     break;
  34.     
  35.   case CRC_INVALID:
  36.   case CRC_ISZERO:
  37.     fputs("*** WARNING *** Program's CRC is invalid.\n"
  38.       "This program may have been infected by a virus.\n", stderr);
  39.     break;
  40.  
  41.   case CRC_NOMEM:
  42.     fputs("Insufficient memory to run CRC calculation.\n", stderr);
  43.     break;
  44.  
  45.   case CRC_FILEERR:
  46.     fputs("Program file not found; cannot calculate CRC.\n", stderr);
  47.     break;
  48.   }
  49.  
  50. return (0);
  51. }
  52.